﻿using System.Windows;
using System;
using Bymed.SpineScan.WPF.ViewModel;
using Bymed.SpineScan.WPF.Shared;
using Bymed.SpineScan.Service.Shared;

namespace Bymed.SpineScan.WPF
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : WindowBase
    {
        /// <summary>
        /// Initializes a new instance of the MainWindow class.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            Closing += (s, e) => ViewModelLocator.Cleanup();

            CheckRunningMode();
        }

        /// <summary>
        /// Check if need to run application under full screen mode.
        /// </summary>
        private void CheckRunningMode()
        {
            if (Convert.ToBoolean(ConfigFileUtility.GetValue(ConfigurationConstant.PatientRunningUnderFullScreenMode)))
            {
                WindowState = System.Windows.WindowState.Maximized;
                WindowStyle = System.Windows.WindowStyle.None;
                AllowsTransparency = true;
            }
        }

        private void BtnMinimize_Click(object sender, RoutedEventArgs e)
        {
            WindowState = WindowState.Minimized;
        }

        private void BtnClose_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }
    }
}